import {
    BeforeInsert,
    CreateDateColumn,
    UpdateDateColumn
} from "typeorm";
import { Expose } from "class-transformer";
import { ApiProperty } from "@nestjs/swagger";
import { transformer } from "@/common/utils/common";
import dayjs from "dayjs";

export class EntityBase {
    @ApiProperty({ type: Date, description: "创建时间" })
    @CreateDateColumn({
        type: "datetime",
        transformer,
        nullable: false,
        comment: "创建时间"
        
    })
    @Expose()
    createAt: Date;
    
    @ApiProperty({ type: Date, description: "更新时间" })
    @UpdateDateColumn({
        type: "datetime",
        transformer,
        nullable: false,
        comment: "更新时间"
    })
    @Expose()
    updateAt: Date;
}
